//
//  ADViewController.swift
//  CompareBuying
//
//  Created by 唐先才 on 16/2/24.
//  Copyright © 2016年 唐先才. All rights reserved.
//

import UIKit

class ADViewController: UIViewController {

    private lazy var backImageView: UIImageView = {
        let backImageView = UIImageView()
        backImageView.frame = UIScreen.mainScreen().bounds
        let time = dispatch_time(DISPATCH_TIME_NOW,Int64(1.5 * Double(NSEC_PER_SEC)))
        switch WIDTH {
        case 320:
            backImageView.image = UIImage(named: "iphone5s")
            dispatch_after(time, dispatch_get_main_queue(), { () -> Void in
                backImageView.removeFromSuperview()
                NSNotificationCenter.defaultCenter().postNotificationName("ADImageLoadSecussed", object: nil)
            })
        case 375:
            backImageView.image = UIImage(named: "iphone6s")
            dispatch_after(time, dispatch_get_main_queue(), { () -> Void in
                backImageView.removeFromSuperview()
                NSNotificationCenter.defaultCenter().postNotificationName("ADImageLoadSecussed", object: nil)
            })
        case 414:
            print("plus___________")
            backImageView.image = UIImage(named: "iphone6sPlus")
            dispatch_after(time, dispatch_get_main_queue(), { () -> Void in
                backImageView.removeFromSuperview()
                NSNotificationCenter.defaultCenter().postNotificationName("ADImageLoadSecussed", object: nil)
            })
        default:
            backImageView.image = UIImage(named: "ipone6sPlus")
            backImageView.removeFromSuperview()
            NSNotificationCenter.defaultCenter().postNotificationName("ADImageLoadSecussed", object: nil)
        }
        return backImageView
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(backImageView)
    }

    override func prefersStatusBarHidden() -> Bool {
        return true
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

}
